<!DOCTYPE html>
<html>
<head>
    <title>Execution Context Example 4</title>
    <script type="text/javascript">
          
        function add(num1, num2) {
            var sum = num1 + num2;
            return sum;
        }
        
        var result = add(10, 20);  //30
        alert(sum);                //causes an error since sum is not a valid variable

      
    </script>

</head>
<body>
  
</body>
</html>